<template>
  <view
    class="safeguard"
    :class="tagsClass"
  >
    <view class="safeguard-slogan">
      <image
        :src="slogan"
        mode="aspectFit"
      ></image>
    </view>
    <view class="safeguard-tags">
      <view
        v-for="(item,index) in items"
        :key="index"
        class="safeguard-tags-item"
      >
        <van-icon :name="item.icon" />
        <text>{{item.text}}</text>
      </view>
    </view>
    <view class="safeguard-brand">
      <image
        :src="logo"
        mode="aspectFit"
      ></image>
    </view>
  </view>
</template>

<script>
export default {
  name: 'SafeGuard',
  props: {
    items: {
      type: Array,
      default: [
        {
          icon: 'certificate',
          text: '如实描述'
        },
        {
          icon: 'certificate',
          text: '参赛保障'
        },
        {
          icon: 'certificate',
          text: '特殊退订服务'
        },
        {
          icon: 'certificate',
          text: '资质公示'
        }
      ]
    },
    slogan: {
      type: String,
      default: '/static/images/safe-slogan.png'
    },
    logo: {
      type: String,
      default: '/static/images/safe-brand.png'
    }
  },
  computed: {
    tagsClass () {
      return this.separator ? 'tags-separator' : ''
    }
  }
}
</script>

<style lang="less">
.safeguard {
  text-align: center;
  background: transparent;
  padding: 20px 0;
  &-slogan {
    position: relative;
    image {
      height: 15px;
    }
    &::before,
    &::after {
      content: "";
      position: absolute;
      height: 1px;
      width: 15%;
      left: 15%;
      top: 8px;
      background: #c1d1e1;
      z-index: -1;
      transform: scale(1, 0.5);
    }
    &::after {
      left: auto;
      right: 15%;
    }
  }
  &-brand {
    image {
      width: 30%;
      height: 20px;
    }
  }
  &-tags {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    padding: 15px;
    color: #c1d1e1;
    &-item {
      display: inline-flex;
      align-items: center;
      transform: scale(0.8);
      text {
        margin-left: 4px;
      }
    }
  }
}
</style>
